<?php
//$this->Html->script(array('plugins/datatables/jquery.dataTables.min'), false);
?>
<?php
echo $this->Form->create('Paginate', array(
	'class' => 'validate',
	'action' => 'index',
	'url' => $this->request->here(false),
	'type' => 'post',
	'inputDefaults' => array('label' => false, 'div' => false)));
echo $this->Form->input('Paginate.task', array('style' => 'display:none;', 'value' => '', 'id' => 'task'));
?>
<div class="page-header clearfix">
	<h1>
		<?php echo __('User management'); ?> 
		<?php echo __('ONLINE LUCKY DRAW SYSTEM'); ?>
	</h1>
	<a href="<?php echo $this->Html->url('/admin/businesses');?>"><?php echo __('Manage business');?></a>
	<div class="page-toolbar pull-right">
		<div class="btn-group ctr-container">
			<a class="btn btn-primary ctr-add" href="<?php echo Router::url(array('action' => 'import')) ?>">
				<span class="ico-add"></span>
				<?php echo __('Import users'); ?>
			</a>
			<!--
			<a class="btn btn-primary ctr-add" href="<?php echo Router::url(array('controller' => 'rewards')) ?>">
				<span class="ico-add"></span>
				<?php echo __('Rewards management'); ?>
			</a>
			-->
			<a class="btn btn-primary ctr-add" href="<?php echo Router::url(array('controller' => 'users', 'action' => 'config')) ?>">
				<span class="ico-add"></span>
				<?php echo __('Configuration'); ?>
			</a>
		</div>
	</div>
</div>

<div class="row-fluid">
	<div class="span12">
		<div class="block">
			<?php
			$Model = ClassRegistry::init('UserReward');
			$continue = array(
				'?' => array('continue' => $this->request->here(false))
			);
			echo $this->Session->flash();
			?>
			<div class="data-fluid">
				<table class="table paginate lcnp" cellpadding="0" cellspacing="0" width="100%">
					<thead>
						<tr>
							<th width="20%"><?php echo __('Booking'); ?></th>
							<th width="20%"><?php echo __('Last name'); ?></th>
							<th width="80"><?php echo __('First name'); ?></th>
							<th width="80"><?php echo __('Email'); ?></th>
							<th width="80"><?php echo __('Play'); ?></th>
							<th width="80"><?php echo __('Nombre de cartes'); ?></th>
							<th width="60" class="TAC">Action</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($users as $user) : ?>
							<tr>
								<td>
									<?php echo $user['User']['booking']; ?>
								</td>
								<td>
									<?php echo $user['User']['last_name']; ?>
								</td>
								<td>
									<?php echo $user['User']['first_name']; ?>
								</td>
								<td>
									<?php echo $user['User']['email'] ?>
								</td>
								<td>
									<?php
									$count = $Model->find('count', array('conditions' => array(
										'user_id' => $user['User']['id'])));
									echo $count ? '<span style="color:#00f;">Oui</span>' : 'Non';
									?>
								</td>
								<td>
									<?php echo $user['User']['amount'] ?>
								</td>
								<td class="table-action">
									<?php
									echo $this->Html->link(__('Delete'), $continue + array('action' => 'delete', $user['User']['id']), array(
										'class' => 'btn btn-primary'
											), 'You want to delete?');
									?>                                             
								</td>
							</tr>
						<?php endforeach; ?>                         
					</tbody>
				</table>                    
			</div> 
		</div>
	</div>
</div>
<?php echo $this->Form->end(); ?>
<style type="text/css">
	.paginate tr.disabled td,.paginate tr.disabled td a{
		color: #f00 !important;
	}
</style>